package com.echo.im.mq.event.model;

import com.echo.im.common.model.platform.IMPlatformCmd;
import com.echo.im.common.model.platform.UserLogoutCmd;
import com.echo.im.mq.contant.QueueConstants;
import com.echo.im.mq.event.BaseEvent;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author: echo
 * @time: 2024-08-16
 */

@Component
public class PlatformCommandMessageEvent extends BaseEvent<IMPlatformCmd<UserLogoutCmd>> {


    @Override
    public EventMessage<IMPlatformCmd<UserLogoutCmd>> buildEventMessage(IMPlatformCmd<UserLogoutCmd> data) {
        return EventMessage.<IMPlatformCmd<UserLogoutCmd> >builder()
                .id(RandomStringUtils.randomNumeric(11))
                .timestamp(new Date())
                .data(data)
                .build();
    }

    @Override
    public String topic() {
        return QueueConstants.PLATFORM_COMMAND_TOPIC;
    }



}
